package com.coderdream.chapter07.builder.a3;

public class Director {

	private Builder builder;
	
	/**
	 * 先把 Builder 的子類的對象實例 存儲在 builder 字段
	 * 
	 * @param builder
	 */
	public Director(Builder builder) {
		this.builder = builder;
	}
	
	/**
	 * 建立文件
	 * 
	 * @return
	 */
	public Object construct() {
		builder.makeTitle("Greeting");// 標題
		builder.makeString("從早上到白天結束");
		builder.makeItems(new String[] {
				"早安。",
				"午安。",
		});
		
		builder.makeString("到了晚上");
		builder.makeItems(new String[] {
				"晚安。",
				"祝你有個好夢。",
				"再見。",
		});
		
		return builder.getResult(); // 完成的文件就是返回值
	}
}
